//
//  SYRequestAPI+Logn.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/5/6.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYRequestAPI+Logn.h"

@implementation SYRequestAPI (Logn)
+ (void)sy_loginServiceAccount:(NSString *)account
                      password:(NSString *)password
                       success:(void(^)(id responseObject))success
                          fail:(FailBlock)fail
{
    NSString *url = LOGINURL;
    NSDictionary *dict = @{@"account":account,
                           @"password":[ZCSecureTools md5:password]
                           };
    [SYRequestAPI postDataFromURLScheme:url parameterDictionary:dict success:^(id responseObject) {
        success(responseObject);
    } fail:^(NSError *error) {
        if (fail) {
            fail(error);
        }
    }];
    
}

//版本号
+ (void)sy_VersionServiceSuccess:(void(^)(id responseObject))success
                            fail:(FailBlock)fail{
    NSString *url = VERSIONURL;
    NSDictionary *dict = @{@"appManner":@"2",
                           @"deviceManner":@"2"
                           };
    [SYRequestAPI postDataFromURLScheme:url parameterDictionary:dict success:^(id responseObject) {
      //  NSLog(@"得到版本号%@",responseObject);
        success(responseObject);
    } fail:^(NSError *error) {
        NSLog(@"得到版本号失败%@",error);
        fail(error);
    }];
}

//获取手机号
+ (void)sy_getPhoneNumber:(NSDictionary *)parama success:(void(^)(id responseObject))success fail:(FailBlock)fail{
    
    [SYRequestAPI postDataFromURLScheme:GETPHONEURL parameterDictionary:parama success:^(id responseObject) {
        success(responseObject);
    } fail:^(NSError *error) {
        fail(error);
    }];
}

+ (void)sy_getYanZhengMaParama:(NSDictionary *)parama success:(void(^)(id responseObject))success fail:(FailBlock)fail{
    [SYRequestAPI postDataFromURLScheme:GETYANZHENGMAURL parameterDictionary:parama success:^(id responseObject) {
      //  NSLog(@"得到验证码%@",responseObject);
        success(responseObject);
    } fail:^(NSError *error) {
        NSLog(@"得到验证码失败%@",error);
        fail(error);
    }];
}
//6.2.1.2手机验证码验证
+ (void)sy_validationCodeParama:(NSDictionary *)parama success:(void(^)(id responseObject))success fail:(FailBlock)fail{
    [SYRequestAPI postDataFromURLScheme:VALIDATIONCODEURL parameterDictionary:parama success:^(id responseObject) {
      //  NSLog(@"得到验证码%@",responseObject);
        success(responseObject);
    } fail:^(NSError *error) {
        NSLog(@"得到验证码失败%@",error);
        if (fail) {
            fail(error);
        }
    }];
}

/**
 重置密码
 */
+ (void)sy_resetPasswordWithParama:(NSDictionary *)parama success:(void(^)(id responseObject))success fail:(FailBlock)fail{
    [SYRequestAPI postDataFromURLScheme:RESETPASSWORDURL parameterDictionary:parama success:^(id responseObject) {
       // NSLog(@"重置密码成功%@",responseObject);
        success(responseObject);
    } fail:^(NSError *error) {
        NSLog(@"重置密码失败%@",error);
        if (fail) {
            fail(error);
        }
    }];
}
@end
